//
//  MineHeaderItemView.m
//  Btpin
//
//  Created by Vic on 2019/3/17.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "MineHeaderItemView.h"

@interface MineHeaderItemView ()
{
    UILabel *countLbl;
    UILabel *textLbl;
    UIView *dotView;
}
@end

@implementation MineHeaderItemView

- (instancetype)initWithFrame:(CGRect)frame text:(NSString *)text {
    self = [super initWithFrame:frame];
    if (self) {
        [self initUIText:text];
    }
    return self;
}
- (void)initUIText:(NSString *)text {
    countLbl = [UIToolsControl initLabelWithFrame:CGRectMake(0, 0, self.frame.size.width, 30*Scale) text:nil textColor:THEMECOLOR_OF_TEXT_333333 font:Font_20];
    countLbl.textAlignment = NSTextAlignmentCenter;
    [self addSubview:countLbl];
    
    textLbl = [UIToolsControl initLabelWithFrame:CGRectMake(0, EndY(countLbl), self.frame.size.width, 23*Scale) text:text textColor:THEMECOLOR_OF_TEXT_9a9a9a font:Font_13];
    textLbl.textAlignment = NSTextAlignmentCenter;
    [self addSubview:textLbl];
    
    dotView = [UIToolsControl initViewWithFrame:CGRectMake(self.frame.size.width*0.5+5, 0, 9*Scale, 9*Scale) backgroundColor:THEMECOLOR_OF_RED];
    dotView.layer.cornerRadius = 4.5*Scale;
    dotView.layer.masksToBounds = YES;
    dotView.hidden = YES;
    [self addSubview:dotView];
}
- (void)setCount:(NSString *)count {
    CGFloat width = [UIToolsControl textWidth:count size:CGSizeMake(MAXFLOAT, 30*Scale) font:Font_20];
    countLbl.text = count;
    dotView.frame = CGRectMake(self.frame.size.width*0.5+width*0.5+5*Scale, 0, 9*Scale, 9*Scale);
}
- (void)setHiddenDoc:(BOOL)hiddenDoc {
    dotView.hidden = hiddenDoc;
}

@end
